import multiprocessing
import time
import random

def fn(ar):
    pname = multiprocessing.current_process().name
    pid = multiprocessing.current_process().pid
    print("进程开始:",pname,pid,ar)

    for i in range(5):
        time.sleep(random.randint(1,3))
        print("子进程%s正在运行"%pname)

if __name__ == '__main__':
    #创建进程 
    p1 = multiprocessing.Process(target=fn,args=('孟非',),name='kangbazi1')
    p2 = multiprocessing.Process(target=fn,args=('乐佳',),name='kangbazi2')

    p1.start()

    p2.start()
